package mycoffee.order.task;

import java.util.ArrayList;

import mycoffee.order.activity.MyCoffeeApplication;
import mycoffee.order.model.Order;
import android.content.Context;

public class OrderEditTask extends AbstractTask<Void, Void, Boolean> {
	private boolean mIsOrderTemp = false;
	private ArrayList<Order> mOrders;

	public OrderEditTask(Context context,
			IDataEventHandler<Boolean> dataEventHandler, boolean isTempOrder,
			ArrayList<Order> orders) {
		super(context, dataEventHandler);
		mIsOrderTemp = isTempOrder;
		mOrders = orders;

	}

	@Override
	protected Boolean doExecute() {
		if (MyCoffeeApplication.mDatabaseConnection != null) {
			// insert
			MyCoffeeApplication.mDatabaseConnection.insertListOrders(mOrders,
					mIsOrderTemp);
		}
		return true;
	}

}
